import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import Login from '../views/login/Login.vue'
import ProjectEditor from '../views/project-editor/ProjectEditor.vue'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/test',
    name: 'test',
    component: () => import('../views/test/TestDrag.vue')
  },
  {
    path: '/',
    name: 'login',
    component: Login
  },
  {
    path: '/dashboard',
    name: 'dashboard',
    component: () => import('../views/dashboard/Dashboard.vue'),
    redirect: 'my-project',
    children: [
      {
        path: '/my-project',
        name: 'my-project',
        component: () => import('../views/dashboard/components/MyProject.vue')
      },
      {
        path: '/cloud-server',
        name: 'cloud-server',
        component: () => import('../views/dashboard/components/CloudServer.vue')
      }
    ]
  },
  {
    path: '/project-editor',
    name: 'project-editor',
    component: ProjectEditor
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
